<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-06 09:56:17
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-02-06 10:05:49
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 获取两个接口类型中的差值属性
type Foo = {
  a: string;
  b: number;
};
type Bar = {
  a: string;
  c: boolean;
};

type Result1 = Diff<Foo, Bar>; // { b: number, c: boolean }
type Result2 = Diff<Bar, Foo>; // { b: number, c: boolean }

type Diff<T, U> = Omit<T, Extract<keyof T, keyof U>> & 
  Omit<U, Extract<keyof U, keyof T>>;
let res : Result1 = {
  b: 1,
  c: true
}
</script>

<style scoped>

</style>